<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>浮动水平居中</title>

    <style type="text/css">
        .box {
            float: left;
            position: relative;
            left: 50%;
            background: orangered;
        }

        p {
            float: left;
            position: relative;
            right: 50%;
        }
    </style>
</head>
<body>
<div class="box">
    <p>我是浮动的</p>
    <p>我也是居中的</p>
</div>
</body>
</html>